###Replication File for Big Lie and Misperceptions--Journal of Experimental Political Science###
###James J. Fahey###

##Packages Required for completing analysis## 
library(dplyr)
library(foreign) #for importing data
library(rio) #for importing data
library(ltm) #for cronbach's alpha
library(lavaan) #for factor analysis
library(estimatr) #for robust standard errors
library(modelsummary) #exporting for LaTeX
library(ggplot2)
library(ggpubr) #For multiple lots on one image 
library(scales)
library(coin)
library(logr)

###Importing Cleaned Data###
###Set working directory to wherever replication files are stored###

MIS_INFO <- import("Rep_Clean_2_3_2022_Misinfo.csv")
MIS_INFO_IND <- import("Ind_Clean_2022_Misinfo.csv")

####Variable Manipulations and Creations####

###Removing "Don't Know" from Ideology Variable###
#Remove Don't Know From Ideology for Summary Statistics
MIS_INFO <- MIS_INFO %>%
  mutate(Ideo_Remove_DK = case_when(
    MIS_INFO$Ideology == 1~1,
    MIS_INFO$Ideology == 2~2,
    MIS_INFO$Ideology == 3~3,
    MIS_INFO$Ideology == 4~4,
    MIS_INFO$Ideology == 5~5,
    MIS_INFO$Ideology == 6~6,
    MIS_INFO$Ideology == 7~7,
    MIS_INFO$Ideology == 8~-99))

MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(Ideo_Remove_DK = case_when(
    MIS_INFO_IND$Ideology == 1~1,
    MIS_INFO_IND$Ideology == 2~2,
    MIS_INFO_IND$Ideology == 3~3,
    MIS_INFO_IND$Ideology == 4~4,
    MIS_INFO_IND$Ideology == 5~5,
    MIS_INFO_IND$Ideology == 6~6,
    MIS_INFO_IND$Ideology == 7~7,
    MIS_INFO_IND$Ideology == 8~-99))

#Replace Missing Codes with Missing
MIS_INFO[MIS_INFO == -99] <- NA
MIS_INFO_IND[MIS_INFO_IND == -99] <- NA 

#Change Treatment Group Variable from Qualtrics to Numbers (Republicans)
MIS_INFO$FL_26_DO<-replace(MIS_INFO$FL_26_DO,MIS_INFO$FL_26_DO=="FL_29","29")
MIS_INFO$FL_26_DO<-replace(MIS_INFO$FL_26_DO,MIS_INFO$FL_26_DO=="FL_28","28")
MIS_INFO$FL_26_DO<-replace(MIS_INFO$FL_26_DO,MIS_INFO$FL_26_DO=="FL_27","27")

transform(MIS_INFO, FL_26_DO = as.numeric (FL_26_DO))

#Retain Numeric Variable for later subsetting 
MIS_INFO$Treatment_num <- as.numeric(MIS_INFO$FL_26_DO)

#Change Treatment Group Variable from Qualtrics to Numbers (Independents)

MIS_INFO_IND$FL_26_DO<-replace(MIS_INFO_IND$FL_26_DO,MIS_INFO_IND$FL_26_DO=="FL_29","29")
MIS_INFO_IND$FL_26_DO<-replace(MIS_INFO_IND$FL_26_DO,MIS_INFO_IND$FL_26_DO=="FL_28","28")
MIS_INFO_IND$FL_26_DO<-replace(MIS_INFO_IND$FL_26_DO,MIS_INFO_IND$FL_26_DO=="FL_27","27")

transform(MIS_INFO_IND, FL_26_DO = as.numeric (FL_26_DO))

#Retain Numeric Variable for later subsetting
MIS_INFO_IND$Treatment_num <- as.numeric(MIS_INFO_IND$FL_26_DO) 

###Creation of Treatment Variables (Republicans)###
#Accuracy Pressure Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(ACCURACY = case_when(
    MIS_INFO$FL_26_DO == 29~1,
    MIS_INFO$FL_26_DO == 28~0,
    MIS_INFO$FL_26_DO == 27~0))

#Response Substitution Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(RESPONSE = case_when(
    MIS_INFO$FL_26_DO == 29~0,
    MIS_INFO$FL_26_DO == 28~1,
    MIS_INFO$FL_26_DO == 27~0))

#Control Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(CONTROL = case_when(
    MIS_INFO$FL_26_DO == 29~0,
    MIS_INFO$FL_26_DO == 28~0,
    MIS_INFO$FL_26_DO == 27~1))

#Treatment Variable (categorical)
MIS_INFO <- MIS_INFO %>%
  mutate(Condition = case_when(
    MIS_INFO$CONTROL == 1~"Control",
    MIS_INFO$RESPONSE == 1~"Response",
    MIS_INFO$ACCURACY == 1~"Accuracy"))

MIS_INFO$Condition <- factor(MIS_INFO$Condition, levels = c("Control", "Accuracy", "Response"))

###Creation of Treatment Variables (Independents)###
#Accuracy Pressure Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(ACCURACY = case_when(
    MIS_INFO_IND$FL_26_DO == 29~1,
    MIS_INFO_IND$FL_26_DO == 28~0,
    MIS_INFO_IND$FL_26_DO == 27~0))

#Response Substitution Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(RESPONSE = case_when(
    MIS_INFO_IND$FL_26_DO == 29~0,
    MIS_INFO_IND$FL_26_DO == 28~1,
    MIS_INFO_IND$FL_26_DO == 27~0))

#Control Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(CONTROL = case_when(
    MIS_INFO_IND$FL_26_DO == 29~0,
    MIS_INFO_IND$FL_26_DO == 28~0,
    MIS_INFO_IND$FL_26_DO == 27~1))

#Treatment Variable (categorical)
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(Condition = case_when(
    MIS_INFO_IND$CONTROL == 1~"Control",
    MIS_INFO_IND$RESPONSE == 1~"Response",
    MIS_INFO_IND$ACCURACY == 1~"Accuracy"))

MIS_INFO_IND$Condition <- factor(MIS_INFO_IND$Condition, levels = c("Control", "Accuracy", "Response"))

###Creation of Demographic Variables (Republicans)###
#Gender Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(FEMALE = case_when(
    MIS_INFO$GENDER == 1~1,
    MIS_INFO$GENDER == 0 ~ 0,
    MIS_INFO$GENDER == 2 ~0))

#White Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(WHITE = case_when(
    MIS_INFO$Race == 0~1,
    MIS_INFO$Race == 1~0,
    MIS_INFO$Race == 2~0,
    MIS_INFO$Race == 3~0,
    MIS_INFO$Race == 4~0,
    MIS_INFO$Race == 5~0,
    MIS_INFO$Race == 6~0,
    MIS_INFO$Race == 7~0))

#College Degree Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(COLLEGE = case_when(
    MIS_INFO$Educ == 0~1,
    MIS_INFO$Educ == 1~0,
    MIS_INFO$Educ == 2~0,
    MIS_INFO$Educ == 3~0,
    MIS_INFO$Educ == 4~0,
    MIS_INFO$Educ == 5~1,
    MIS_INFO$Educ == 6~1,
    MIS_INFO$Educ == 7~1))

###Creation of Demographic Variables (Independents)
#Gender Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(FEMALE = case_when(
    MIS_INFO_IND$GENDER == 1~1,
    MIS_INFO_IND$GENDER == 0 ~ 0,
    MIS_INFO_IND$GENDER == 2 ~0))

#White Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(WHITE = case_when(
    MIS_INFO_IND$Race == 0~1,
    MIS_INFO_IND$Race == 1~0,
    MIS_INFO_IND$Race == 2~0,
    MIS_INFO_IND$Race == 3~0,
    MIS_INFO_IND$Race == 4~0,
    MIS_INFO_IND$Race == 5~0,
    MIS_INFO_IND$Race == 6~0,
    MIS_INFO_IND$Race == 7~0))

#College Degree Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(COLLEGE = case_when(
    MIS_INFO_IND$Educ == 0~1,
    MIS_INFO_IND$Educ == 1~0,
    MIS_INFO_IND$Educ == 2~0,
    MIS_INFO_IND$Educ == 3~0,
    MIS_INFO_IND$Educ == 4~0,
    MIS_INFO_IND$Educ == 5~1,
    MIS_INFO_IND$Educ == 6~1,
    MIS_INFO_IND$Educ == 7~1))

###Creation of Dependent Variables (Republicans)###
#Moon Landing Dummy 
MIS_INFO <- MIS_INFO %>%
  mutate(MOON_DUMMY = case_when(
    MIS_INFO$MoonLanding == 1~1,
    MIS_INFO$MoonLanding == 0 ~ 0,
    MIS_INFO$MoonLanding == 2 ~0))

#Election Winner Dummy 
MIS_INFO <- MIS_INFO %>%
  mutate(ELEC_DUMMY = case_when(
    MIS_INFO$ElectionWinner == 1~1,
    MIS_INFO$ElectionWinner == 0 ~ 0,
    MIS_INFO$ElectionWinner == 2 ~0))

#Votes Changed Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(VOTE_CHANGE_DUMMY = case_when(
    MIS_INFO$VotesChanged == 1~1,
    MIS_INFO$VotesChanged == 0 ~ 0,
    MIS_INFO$VotesChanged== 2 ~0))

#Antifa Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(ANTIFA_DUMMY = case_when(
    MIS_INFO$Antifa == 1~1,
    MIS_INFO$Antifa == 0 ~ 0,
    MIS_INFO$Antifa == 2 ~0))

#Illegal Immigrant Vote Dummy
MIS_INFO <- MIS_INFO %>%
  mutate(IMM_VOTE_DUMMY = case_when(
    MIS_INFO$Immigrant_Voted == 1~1,
    MIS_INFO$Immigrant_Voted == 0 ~ 0,
    MIS_INFO$Immigrant_Voted == 2 ~0))

#Covid Dummy 
MIS_INFO <- MIS_INFO %>%
  mutate(COVID_DUMMY = case_when(
    MIS_INFO$COVID19_Conspiracy == 1~1,
    MIS_INFO$COVID19_Conspiracy == 0 ~ 0,
    MIS_INFO$COVID19_Conspiracy == 2 ~0))

###Creation of Dependent Variables (Independents)###
#Create Dependent Variables (Conspiracy Belief Dummies)
#Moon Landing Dummy 
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(MOON_DUMMY = case_when(
    MIS_INFO_IND$MoonLanding == 1~1,
    MIS_INFO_IND$MoonLanding == 0 ~ 0,
    MIS_INFO_IND$MoonLanding == 2 ~0))

#Election Winner Dummy 
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(ELEC_DUMMY = case_when(
    MIS_INFO_IND$ElectionWinner == 1~1,
    MIS_INFO_IND$ElectionWinner == 0 ~ 0,
    MIS_INFO_IND$ElectionWinner == 2 ~0))

#Votes Changed Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(VOTE_CHANGE_DUMMY = case_when(
    MIS_INFO_IND$VotesChanged == 1~1,
    MIS_INFO_IND$VotesChanged == 0 ~ 0,
    MIS_INFO_IND$VotesChanged== 2 ~0))

#Antifa Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(ANTIFA_DUMMY = case_when(
    MIS_INFO_IND$Antifa == 1~1,
    MIS_INFO_IND$Antifa == 0 ~ 0,
    MIS_INFO_IND$Antifa == 2 ~0))

#Illegal Immigrant Vote Dummy
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(IMM_VOTE_DUMMY = case_when(
    MIS_INFO_IND$Immigrant_Voted == 1~1,
    MIS_INFO_IND$Immigrant_Voted == 0 ~ 0,
    MIS_INFO_IND$Immigrant_Voted == 2 ~0))

#Covid Dummy 
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(COVID_DUMMY = case_when(
    MIS_INFO_IND$COVID19_Conspiracy == 1~1,
    MIS_INFO_IND$COVID19_Conspiracy == 0 ~ 0,
    MIS_INFO_IND$COVID19_Conspiracy == 2 ~0))

####Data Cleaning--Removal of Low Quality Respondents and Outside Scope (Republicans)####
#Remove Suspected Text-Assist/Random Satisficers--Those Who Took Less than Minimum Acceptable Time to Complete Survey
MIS_INFO <- subset(MIS_INFO, Duration >= 120)

#Remove Attention Check Failures 
MIS_INFO <- subset (MIS_INFO, Attention_Check_Con != 1)

####Data Cleaning--Removal of Low Quality Respondents and Outside Scope (Independents)####
#Remove Suspected Text-Assist/Random Satisficers--Those Who Took Less than Minimum Acceptable Time to Complete Survey
##Drop Partisans from Independent Sample
MIS_INFO_IND <- subset(MIS_INFO_IND, PID == 2 | PID == 3)

##Remove Individuals Who Lean Towards Democrats 
MIS_INFO_IND <- subset(MIS_INFO_IND, ind1 != 1)

#Remove Suspected Text-Assist/Random Satisficers--Those Who Took Less than Minimum Acceptable Time to Complete Survey
MIS_INFO_IND <- subset(MIS_INFO_IND, Duration >= 120)

#Remove Attention Check Failures 
MIS_INFO_IND <- subset (MIS_INFO_IND, Attention_Check_Con != 1)

####Confirmatory Factor Analysis for Regressions####
###For Formatted CFA Results see Appendices A.3 & A.4 (Republicans) and Appendices B.1 & B.2###

#Factor Analysis One: Conspiracy Theory Battery Drop Covid (Republicans)
MIS_INFO_ELEC_SUB <- subset(MIS_INFO, select = c(VOTE_CHANGE_DUMMY, ANTIFA_DUMMY, ELEC_DUMMY, IMM_VOTE_DUMMY))
FactorModel_3  <- ' h =~ NA*VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY 
h ~~ 1*h ' 

fit <- cfa(FactorModel_3, data = MIS_INFO)
summary(fit, fit.measures = TRUE, standardized = TRUE)

#Factor Analysis Two: Conspiracy Theory Battery Including Covid (Republicans)
MIS_INFO_CON_SUB <- subset(MIS_INFO, select = c(VOTE_CHANGE_DUMMY, ANTIFA_DUMMY, ELEC_DUMMY, IMM_VOTE_DUMMY, COVID_DUMMY))

FactorModel_2  <- ' g =~ NA*VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY + COVID_DUMMY
g ~~ 1*g ' 

fit_2 <- cfa(FactorModel_2, data = MIS_INFO)
summary(fit_2, fit.measures = TRUE, standardized = TRUE)

#Factor Analysis Three: Conspiracy Theory Battery Drop Covid (Independents)
MIS_INFO_IND_ELEC_SUB <- subset(MIS_INFO_IND, select = c(VOTE_CHANGE_DUMMY, ANTIFA_DUMMY, ELEC_DUMMY, IMM_VOTE_DUMMY))
FactorModel_3  <- ' h =~ NA*VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY 
h ~~ 1*h ' 

fit <- cfa(FactorModel_3, data = MIS_INFO_IND)
summary(fit, fit.measures = TRUE, standardized = TRUE)

#Factor Analysis Four: Conspiracy Theory Battery Including Covid (Independents)
MIS_INFO_IND_CON_SUB <- subset(MIS_INFO_IND, select = c(VOTE_CHANGE_DUMMY, ANTIFA_DUMMY, ELEC_DUMMY, IMM_VOTE_DUMMY, COVID_DUMMY))

FactorModel_4  <- ' g =~ NA*VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY + COVID_DUMMY
g ~~ 1*g ' 

fit_4 <- cfa(FactorModel_4, data = MIS_INFO_IND)
summary(fit_4, fit.measures = TRUE, standardized = TRUE)

###Creation of New Factor Variables (Omnibus, Big Lie, and Self-Monitor)###
#Self Moniotor Factor Variable (Republicans) 
MIS_INFO <- MIS_INFO %>%
  mutate(SELF_MON_FAC = self_mon_1 + self_mon_2 + self_mon_3)

#Right Wing Conspiracy Factor Variable (Republicans)
MIS_INFO <- MIS_INFO %>%
  mutate(RIGHT_CON_FAC = COVID_DUMMY + VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY)

#Election Conspiracy Only Factor Variable (Republicans)
MIS_INFO <- MIS_INFO %>%
  mutate(BIG_LIE_FAC = VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY)

#Self Monitor Factor Variable (Independents)
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(SELF_MON_FAC = self_mon_1 + self_mon_2 + self_mon_3)

#Right Wing Conspiracy Factor Variable (Independents)
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(RIGHT_CON_FAC = COVID_DUMMY + VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY)

#Election Conspiracy Only Factor Variable (Independents)
MIS_INFO_IND <- MIS_INFO_IND %>%
  mutate(BIG_LIE_FAC = VOTE_CHANGE_DUMMY + ANTIFA_DUMMY + ELEC_DUMMY + IMM_VOTE_DUMMY)

#Subset Out Only Attentive Trump Supporters 
MIS_INFO_TRUMP <- subset(MIS_INFO, Vote_Choice_Recall == 1)

#Subset Out Only Attentive Republicans 
MIS_INFO_Repub <- subset(MIS_INFO, PID == 1)

###Regression Model 1: Treatment on Support for Factor Variable (Republican), Appendix A.5###
models_a_rep <- list(
  "Big Lie"     = lm(BIG_LIE_FAC ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                     data = MIS_INFO_Repub),
  "Omnibus" = lm(RIGHT_CON_FAC ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                 data = MIS_INFO_Repub))

modelsummary(models_a_rep, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring", "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")

###Figure 1: Effect of Treatment on Factor Variables (Republican)###
quartz.options(width = 5, height = 4)

cm <- c('ConditionAccuracy' = 'Accuracy',
        'ConditionResponse' = 'Response')

b <- list(geom_vline(xintercept = 0, color = 'gray'))

modelplot(models_a_rep, vcov = "robust", coef_map = cm, background = b) +
  theme(text = element_text(size = 8)) + 
  guides(color = guide_legend(reverse = TRUE)) + 
  labs(x = 'Change in Endorsement of False Statement', 
       y = '',
       title = 'Treatment on Misperceptions',
       caption = "Data Source: CloudResearch Sample of Self-Indicated Republicans, Feb 3 2022. \n Dots represent OLS point estimates. \n N = 1486. \n 95% confidence intervals presented with robust standard errors.") +
  theme(panel.border = element_rect(color = "black", fill = NA, size = .1))

quartz.save(type = "png", dpi = 500)

###Regression Model 2: Treatment on Support for Individual Variable (Republican) Appendix A.6###
models_b_rep <- list(
  "Votes Changed"     = lm(VOTE_CHANGE_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                           data = MIS_INFO_Repub),
  "Imm Vote" = lm(IMM_VOTE_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                  data = MIS_INFO_Repub),
  "Elec Winner" = Conspiracy_Elec_Winner_Rep <- lm(ELEC_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + 
                                                     SELF_MON_FAC, data = MIS_INFO_Repub),
  "Antifa" = lm(ANTIFA_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                data = MIS_INFO_Repub)
  ,
  "Covid" = lm(COVID_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
               data = MIS_INFO_Repub),
  "Moon"     = lm(MOON_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                  data = MIS_INFO_Repub))

modelsummary(models_b_rep, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring", "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")

###Figure 2: Effect of Treatment on Individual Misperceptions (Republican)###
modelplot(models_b_rep, vcov = "robust", coef_map = cm, background = b) +
  theme(text = element_text(size = 8)) + 
  guides(color = guide_legend(reverse = TRUE)) + 
  labs(x = 'Change in Endorsement of False Statement', 
       y = '',
       title = 'Treatment on Misperceptions',
       caption = "Data Source: CloudResearch Sample of Self-Indicated Republicans, Feb 3 2022. \n Dots represent OLS point estimates. \n N = 1486. \n 95% confidence intervals presented with robust standard errors.") +
  theme(panel.border = element_rect(color = "black", fill = NA, size = .1))

quartz.save(type = "png", dpi = 500)

###Regression Model 3: Treatment on Support for Factor Variables (Trump Supporters) Appendix A.7###
models_a_Trump <- list(
  "Big Lie"     = lm(BIG_LIE_FAC ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                     data = MIS_INFO_TRUMP ),
  "Omnibus" = lm(RIGHT_CON_FAC ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                 data = MIS_INFO_TRUMP))

modelsummary(models_a_Trump, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring", "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")

###Figure 3: Effect of Treatment on Factor Misperceptions (Trump supporters)###
modelplot(models_a_Trump, vcov = "robust", coef_map = cm, background = b) +
  theme(text = element_text(size = 8)) + 
  guides(color = guide_legend(reverse = TRUE)) + 
  labs(x = 'Change in Endorsement of False Statement', 
       y = '',
       title = 'Treatment on Misperceptions',
       caption = "Data Source: CloudResearch Sample of Self-Indicated Trump Supporters, Feb 3 2022. \n Dots represent OLS point estimates. \n N = 1309. \n 95% confidence intervals presented with robust standard errors.") +
  theme(panel.border = element_rect(color = "black", fill = NA, size = .1))

###Regression Model 4: Treatment on Support for Individual Misperceptions (Trump Supporters) A.8
models_b_Trump <- list(
  "Votes Changed"= lm(VOTE_CHANGE_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                      data = MIS_INFO_TRUMP),
  "Imm Vote" = lm(IMM_VOTE_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                  data = MIS_INFO_TRUMP),
  "Elec Winner"= Conspiracy_Elec_Winner_Rep <- lm(ELEC_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + 
                                                    SELF_MON_FAC, data = MIS_INFO_TRUMP),
  "Antifa" = lm(ANTIFA_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                data = MIS_INFO_TRUMP),
  "Covid" = lm(COVID_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
               data = MIS_INFO_TRUMP),
  "Moon"= lm(MOON_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
             data = MIS_INFO_TRUMP))

modelsummary(models_b_Trump, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring", "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")

###Figure 4: Effect of Treatment on Individual Misperceptions (Trump Supporters)###
modelplot(models_b_Trump, vcov = "robust", coef_map = cm, background = b) +
  theme(text = element_text(size = 8)) + 
  guides(color = guide_legend(reverse = TRUE)) + 
  labs(x = 'Change in Endorsement of False Statement', 
       y = '',
       title = 'Treatment on Misperceptions',
       caption = "Data Source: CloudResearch Sample of Self-Indicated Trump Supporters, Feb 3 2022. \n Dots represent OLS point estimates. \n N = 1309. \n 95% confidence intervals presented with robust standard errors.") +
  theme(panel.border = element_rect(color = "black", fill = NA, size = .1))

###Regression Model 5: Treatment on Support for Factor Misperceptions (Independents)
models_a_ind <- list(
  "Big Lie"     = lm(BIG_LIE_FAC ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                     data = MIS_INFO_IND),
  "Omnibus" = lm(RIGHT_CON_FAC ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                 data = MIS_INFO_IND))

modelsummary(models_a_ind, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring", "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch via mTurk, Mar 7-11 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")


###Figure 5: Effect of Treatment on Factor Misperceptions (Independents)###
modelplot(models_a_ind, vcov = "robust", coef_map = cm, background = b) +
  theme(text = element_text(size = 8)) + 
  guides(color = guide_legend(reverse = TRUE)) + 
  labs(x = 'Change in Endorsement of False Statement', 
       y = '',
       title = 'Treatment on Misperceptions',
       caption = "CloudResearch via mTurk. Independents and Republican Leaners, Mar 7-11 2022. \n Dots represent OLS point estimates. \n N = 592. \n 95% confidence intervals presented with robust standard errors.") +
  theme(panel.border = element_rect(color = "black", fill = NA, size = .1))

###Regression Model 6: Treatment on Support for Individual Misperceptions (Independents) 
models_b_ind <- list(
  "Votes Changed"     = lm(VOTE_CHANGE_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                           data = MIS_INFO_IND),
  "Imm Vote" = lm(IMM_VOTE_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                  data = MIS_INFO_IND),
  "Elec Winner" = Conspiracy_Elec_Winner_Rep <- lm(ELEC_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + 
                                                     SELF_MON_FAC, data = MIS_INFO_IND),
  "Antifa" = lm(ANTIFA_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                data = MIS_INFO_IND)
  ,
  "Covid" = lm(COVID_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
               data = MIS_INFO_IND),
  "Moon"     = lm(MOON_DUMMY ~ Condition + WHITE + FEMALE + AGE + COLLEGE + SELF_MON_FAC, 
                  data = MIS_INFO_IND))

modelsummary(models_b_ind, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring", "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch via mTurk, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")

###Figure 6: Effect of Treatment on Individual Misperceptions (Independents)###
modelplot(models_b_ind, vcov = "robust", coef_map = cm, background = b) +
  theme(text = element_text(size = 8)) + 
  guides(color = guide_legend(reverse = TRUE)) + 
  labs(x = 'Change in Endorsement of False Statement', 
       y = '',
       title = 'Treatment on Misperceptions',
       caption = "CloudResearch via mTurk. Independents and Republican Leaners, Mar 7-11 2022. \n Dots represent OLS point estimates. \n N = 592. \n 95% confidence intervals presented with robust standard errors.") +
  theme(panel.border = element_rect(color = "black", fill = NA, size = .1))

###Alternate Hypothesis--Testing Assignment to Treatment Group on Support for Trump (Appendix A.9)###

MIS_INFO_Repub <- MIS_INFO_Repub %>%
  mutate(Trump_Dummy = case_when(
    MIS_INFO_Repub$Vote_Choice_Recall == 1 ~ 1,
    MIS_INFO_Repub$Vote_Choice_Recall == 2 ~ 0,
    MIS_INFO_Repub$Vote_Choice_Recall == 3 ~ 0))

models_rep_vote <- lm(Trump_Dummy ~  Condition + WHITE + Ideology + FEMALE + AGE + COLLEGE, 
                      data = MIS_INFO_Repub)

modelsummary(models_rep_vote, vcov = "robust",
             stars = TRUE,
             coef_rename = c("Trump_Dummy" = "Trump", "WHITE" = "White", "ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")

###Two-Sample Brown-Mood Median Test: Assessing Whether Accuracy Pressure Significantly Increased Cognitive Load (Republicans and Independents)
Republican_Time <- subset(MIS_INFO, MIS_INFO$Treatment_num  == 29| MIS_INFO$Treatment_num == 27)
median_test(Duration~Condition, data = Republican_Time)

Independent_Time <- subset(MIS_INFO_IND, MIS_INFO_IND$Treatment_num  == 29| MIS_INFO_IND$Treatment_num == 27)
median_test(Duration~Condition, data = Independent_Time)

###Demographic Variables (Formatted as Table in Appendix A.1)###
###Summary Statistics (Republicans and Independents)###
#Age
mean(MIS_INFO_Repub$AGE, na.rm = T)
sd(MIS_INFO_Repub$AGE, na.rm = T)

#Education
table(MIS_INFO_Repub$COLLEGE)

#Race
table(MIS_INFO_Repub$WHITE)

#Ideology
mean(MIS_INFO_Repub$Ideo_Remove_DK, na.rm = T)
sd(MIS_INFO_Repub$Ideo_Remove_DK, na.rm = T)

#Gender
mean(MIS_INFO_Repub$GENDER, na.rm = T)

#Age
mean(MIS_INFO_IND$AGE, na.rm = T)
sd(MIS_INFO_IND$AGE, na.rm = T)

#Education
table(MIS_INFO_IND$COLLEGE)

#Race
table(MIS_INFO_IND$WHITE)

#Ideology
mean(MIS_INFO_IND$Ideo_Remove_DK, na.rm = T)
sd(MIS_INFO_IND$Ideo_Remove_DK, na.rm = T)

#Gender
mean(MIS_INFO_IND$GENDER, na.rm = T)

###Endorsement of Conspiracy Theories (Formatted as Table in Appendix A.2)###
###Summary Statistics (Republicans and Independents)

#Moon Landing 
mean(MIS_INFO_Repub$MOON_DUMMY, na.rm = T)

#Election Winner
mean(MIS_INFO_Repub$ELEC_DUMMY, na.rm = T)

#Vote Change
mean(MIS_INFO_Repub$VOTE_CHANGE_DUMMY, na.rm = T)

#Antifa
mean(MIS_INFO_Repub$ANTIFA_DUMMY, na.rm = T)

#Imm Vote
mean(MIS_INFO_Repub$IMM_VOTE_DUMMY, na.rm = T)

#COVID
mean(MIS_INFO_Repub$COVID_DUMMY, na.rm = T)

#Moon Landing 
mean(MIS_INFO_IND$MOON_DUMMY, na.rm = T)

#Election Winner
mean(MIS_INFO_IND$ELEC_DUMMY, na.rm = T)

#Vote Change
mean(MIS_INFO_IND$VOTE_CHANGE_DUMMY, na.rm = T)

#Antifa
mean(MIS_INFO_IND$ANTIFA_DUMMY, na.rm = T)

#Imm Vote
mean(MIS_INFO_IND$IMM_VOTE_DUMMY, na.rm = T)

#COVID
mean(MIS_INFO_IND$COVID_DUMMY, na.rm = T)

###Regression Including Self-Monitor Interaction (Republicans) Appendix C.1###
models_interaction_rep <- list(
  "Big Lie"     = lm(BIG_LIE_FAC ~ Condition*SELF_MON_FAC + WHITE + FEMALE + AGE + COLLEGE, 
                     data = MIS_INFO_Repub),
  "Omnibus" = lm(RIGHT_CON_FAC ~ Condition*SELF_MON_FAC + WHITE + FEMALE + AGE + COLLEGE, 
                 data = MIS_INFO_Repub))

modelsummary(models_interaction_rep, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring",
                             "ConditionAccuracy:SELF_MON_FAC" = "Accuracy X Self Monitoring",
                             "ConditionResponse:SELF_MON_FAC" = "Response X Self Monitoring",
                             "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")

###Regression Including Self-Monitor Interaction (Trump Supporters)###
models_interaction_trump <- list(
  "Big Lie"     = lm(BIG_LIE_FAC ~ Condition*SELF_MON_FAC + WHITE + FEMALE + AGE + COLLEGE, 
                     data = MIS_INFO_TRUMP),
  "Omnibus" = lm(RIGHT_CON_FAC ~ Condition*SELF_MON_FAC + WHITE + FEMALE + AGE + COLLEGE, 
                 data = MIS_INFO_TRUMP))

modelsummary(models_interaction_trump, vcov = "robust",
             stars = TRUE,
             coef_rename = c("ConditionAccuracy" = "Accuracy", "ConditionResponse" = "Response",
                             "SELF_MON_FAC" = "Self Monitoring",
                             "ConditionAccuracy:SELF_MON_FAC" = "Accuracy X Self Monitoring",
                             "ConditionResponse:SELF_MON_FAC" = "Response X Self Monitoring",
                             "WHITE" = "White", 
                             "FEMALE" = "Female", "AGE" = "Age", "COLLEGE" = "College Educated"),
             notes = list ('Robust Standard Errors in parentheses',
                           'Source: CloudResearch, Feb. 3, 2022.'),
             gof_omit = 'DF|Deviance|R2|Log.Lik.|BIC|Std. Errors',
             output = "latex")


